BIN=process
#SRC=$(shell ls *.c)
SRC=$(wildcard *c)
OBJ=$(SRC:.c=.o)
CC=gcc
RM=rm -rf

$(BIN):$(OBJ)
	@$(CC) $^ -o $@
	@echo "链 接 $^ 成 $@"
%.o:%.c
	@$(CC) -c $< # -g
	@echo "编 译 ... $< 成 $@"

.PHONY:clean
clean:
	@$(RM) $(OBJ) $(BIN)

.PHONY:test
test:
	@echo $(BIN)
	@echo $(SRC)
	@echo $(OBJ)


# BIN=mytest
# #SRC=$(shell ls *.c)
# SRC=$(wildcard *c)
# OBJ=$(SRC:.c=.o)
# CC=gcc
# RM=rm -rf
# 
# $(BIN):$(OBJ)
#     @$(CC) $^ -o $@
#     @echo "链 接 $^ 成 $@"
# %.o:%.c
#     @$(CC) -c $<
#     @echo "编 译 ... $< 成 $@"
# 
# .PHONY:clean
# clean:
#     @$(RM) $(OBJ) $(BIN)
# 
# .PHONY:test
# test:
#     @echo $(BIN)
#     @echo $(SRC)
#     @echo $(OBJ)

#$(BIN):$(OBJ)
#   $(CC) $(OBJ) -o $(BIN)
#$(OBJ):$(SRC)
#   $(CC) -c $(SRC) -o $(OBJ)    
#    
#.PHONY:clean    
#clean:    
#   $(RM) $(OBJ) $(BIN)    
    
#mycode:code.o    
#   gcc code.o -o mycode                                                                                                                                                                                  
#code.o:code.s    
#   gcc -c code.s -o code.o    
#code.s:code.i    
#   gcc -S code.i -o code.s    
#code.i:code.c    
#   gcc -E code.c -o code.i    
#    
#.PHONY:clean
#clean:
#   rm -rf *.i *.s *.o mycode

#mytest:code.c
#   gcc code.c -o mytest 
#
#.PHONY:clean
#clean:
#   rm -rf mytest
